package com.yanboo.generator.domain;

import com.yanboo.common.base.BaseEntity;
import com.yanboo.common.constant.GlobalConstant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import jakarta.persistence.*;
import java.io.Serializable;

/**
 * 列的数据信息
 */
@Getter
@Setter
@Entity
@DynamicInsert
@DynamicUpdate
@Accessors(chain = true)
@Table(name = "code_column_config")
public class ColumnInfo extends BaseEntity implements Serializable {

    @Schema(description = "项目编码")
    @Column(length = 180)
    @ColumnDefault(value = GlobalConstant.DEFAULT_PROJECT_CODE)
    private String projectCode;

    @Schema(description = "表名")
    @Column(length = 180)
    private String tableName;

    @Schema(description = "数据库字段名称")
    private String columnName;

    @Schema(description = "数据库字段类型")
    private String columnType;

    @Schema(description = "数据库字段键类型")
    private String keyType;

    @Schema(description = "字段额外的参数")
    private String extra;

    @Schema(description = "数据库字段描述")
    private String remark;

    @Schema(description = "是否必填")
    private Boolean notNull;

    @Schema(description = "是否在列表显示")
    private Boolean listShow;

    @Schema(description = "是否表单显示")
    @ColumnDefault(value = "false")
    private Boolean formShow;

    @Schema(description = "表单类型")
    private String formType;

    @Schema(description = "查询 1:模糊 2：精确")
    private String queryType;

    @Schema(description = "字典名称")
    private String dictName;

    @Schema(description = "日期注解")
    private String dateAnnotation;
}
